import { api } from "@/lib/request";
import { type Response, type FileUploadResponseData } from "@/types/response";

export const fileAPI = {
  upload: async (file: File): Promise<Response & { data: FileUploadResponseData }> => {
    const formData = new FormData();
    formData.append("file", file);

    const response = await api.post("/file/upload", formData, {
      headers: {
        "Content-Type": "multipart/form-data",
      },
    });
    return response as unknown as Response & { data: FileUploadResponseData };
  },
};
